Images are often represented by vector graphics including curves, such as splines (e.g., piecewise polynomials), since such a representation is independent of resolution and therefore image quality can be maintained across multiple resolution formats. Editing images represented by curves, such as in a workflow to create an animation sequence from the image, traditionally involves editing the curves based on basis points. These editing techniques are extremely time consuming, and require a high level of expertise on behalf of the graphic designer.
Consequently, editing techniques (e.g., animation workflows) have been recently developed that do not operate directly on the curve representation of an image, but instead operate on a geometry of an interior of the image created from small primitives, such as a mesh of triangles (e.g., a triangle mesh). For instance, an animation sequence can be generated by iteratively deforming the triangle mesh to generate different images in the animation sequence. Accordingly, techniques are needed to generate such a geometry (e.g., a triangle mesh) for an image represented by curves.
One method of generating a triangle mesh for an image represented by curves is to populate the convex hull of a tightest polygon that encloses the image (e.g., all the curves of the image lie within the polygon) with a triangle mesh. As an example, FIG. 1 illustrates an example image 100 in accordance with one or more aspects of the disclosure. Example image 100 includes artwork 102 (e.g., a crocodile) and mesh 104. Mesh 104 is generated from the convex hull of a tightest polygon that encloses artwork 102 (e.g., the crocodile). Accordingly, mesh 104 overlaps not only the crocodile, but also regions not represented by the crocodile, such as region 106 under the crocodile's belly and between the crocodile's head and tail, generally denoted in FIG. 1 with a dashed circle. For instance, region 106 includes mesh 104, but does not include artwork 102. As a result, mesh 104 connects components of the crocodile that were not originally connected in artwork 102. Consequently, when mesh 106 is deformed, such as by selecting and dragging one of handles 108, the crocodile may be deformed in an undesired way. For instance, moving the crocodile's tail will also move the crocodile's head, moving one of the crocodile's legs will also move another of the crocodile's legs, and the like. Therefore, methods that generate a triangle mesh for an image from the convex hull of a tightest polygon that encloses the image do not produce acceptable triangle meshes for most graphics workflows, such as generating animation sequences.
Another method of generating a triangle mesh for an image represented by curves is to sample the curves of the image and use the sample points as vertices of triangles in a triangle mesh. Though such a method generally overcomes the shortcomings of the convex-hull approach discussed above, the density of the triangle mesh generated from samples of curves is not decoupled from the density of the curves. Thus, the triangle mesh can contain a prohibitively large number of triangles (e.g., millions of triangles for reasonable samplings of curves of realistic images), which require prohibitively large numbers of calculations and computing resources in most graphics workflows. Moreover, for complex curve representations, methods that sample the curves and use the samples as vertices of triangles can lack robustness and fail to generate a triangle mesh in regions of high complexity of the curves.
Furthermore, both methods (i) that generate a triangle mesh for an image from the convex hull of a tightest polygon that encloses the image, and (ii) that sample the curves and use the samples as vertices of triangles, do not generate a mesh for regions of an image obscured by a clipping path. For instance, when an image is inserted into a bounding shape, such as box, circle, star, and the like, a region of the image can be masked by the bounding shape, creating a clipping path. Both methods (i) and (ii) do not generate a mesh for regions outside the clipping path and account for these regions when the mesh is deformed, and therefore may provide unsatisfactory results for graphics workflows that incorporate clipping paths.